<?php
class MySql{
    public  $link;
    public  function  __construct($host,$user,$pass,$db)
    {
        $this->link=mysqli_connect($host,$user,$pass,$db);
        echo "初始化完成";
    }
    public  function select($table){
        $sql="select * from $table";
        $query=mysqli_query($this->link,$sql);
        $data=[];
        while ($row=mysqli_fetch_assoc($query)){
            array_push($data,$row);
        }
        return $data;
    }
    public  function delete($table,$id){
        $sql="delete from $table where id=$id";
    }

}

$li=new MySql('localhost','root','root','book');

var_dump($li->select('users'));

$li->delete('users',2);